<?php

namespace App\Models;

use App\User;
use Illuminate\Database\Eloquent\Model;

class FileTransaction extends Model
{
    protected $table = 'video_files_transaction';

    protected $fillable = [
        'author_id',
        'name',
        'path',
        'file_path',
        'size',
        'mime_type',
        'is_upload',
        'status',
        'config_id'
    ];

    protected $casts = [
        'is_upload' => 'boolean',
        'status'    => 'boolean'
    ];

    public function config()
    {
        return $this->belongsTo(Qiniu::class, 'config_id', 'id');
    }

    public function author()
    {
        return $this->belongsTo(User::class, 'author_id', 'id');
    }
}
